//package com.example.demo.controller;
//
////import org.apache.rocketmq.common.message.MessageConst;
////import org.apache.rocketmq.spring.support.RocketMQHeaders;
//import com.example.demo.entity.MyMessage;
//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
//import org.apache.rocketmq.spring.core.RocketMQTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
////import org.springframework.cloud.stream.annotation.StreamListener;
////import org.springframework.cloud.stream.messaging.Sink;
////import org.springframework.cloud.stream.messaging.Source;
//import org.springframework.context.event.EventListener;
////import org.springframework.messaging.Message;
////import org.springframework.messaging.support.MessageBuilder;
//import org.springframework.messaging.Message;
//import org.springframework.messaging.support.MessageBuilder;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.time.LocalDateTime;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
//
//@RestController
//public class SendController {
//    @Autowired
//    private RocketMQTemplate rocketMQTemplate;
////    @Autowired
////    private Source source;
////
////    @GetMapping("send")
////    public String send(String msg) {
////        Message<String> message = MessageBuilder.withPayload(msg)
////                .setHeader(RocketMQHeaders.TAGS, "test")
////                .setHeader(RocketMQHeaders.KEYS, "my-test")
////                .setHeader(MessageConst.PROPERTY_DELAY_TIME_LEVEL, "1")
////                .build();
////        source.output().send(message);
////        return "hello rockermq,send " + msg;
////    }
////
////    @StreamListener(value = Sink.INPUT)
////    public void receive(String msg) {
////        System.out.println("接收消息： " + msg + ", 时间：" + LocalDateTime.now().toString() + ",当前线程：" + Thread.currentThread().getName());
////    }
//    @GetMapping("send")
//    public String send(String msg) {
//        MyMessage message = new MyMessage("1001", "hello");
//        Message messageMessage = MessageBuilder.withPayload(message).build();
//        List<Message> messages = Arrays.asList(messageMessage, messageMessage, messageMessage, messageMessage, messageMessage);
//
//        rocketMQTemplate.syncSend("my-test", messages);
////        rocketMQTemplate.convertAndSend("my-test", "hello test demo");
//        return "发送完毕：" + msg;
//    }
//
//
//    public void receive(String msg) {
//
//    }
//}
